/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2018 All Rights Reserved.
 */
package com.sgzn.sgpay.service.converter;

import com.sgzn.sgpay.model.response.DeviceStatisticDto;
import com.sgzn.sgpay.model.response.vo.ShopDetailVo;
import com.sgzn.sgpay.persistence.domain.TShop;

/**
 * 门店响应转换类
 * @author zhongzhongyong
 * @version Id: ShopRespConverter.java, v 0.1 2018/5/21 22:51 zhongzhongyong Exp $$
 */
public class ShopRespConverter {

    /**
     * 获取门店详情实体
     * @param tShop
     * @param dto
     * @return
     */
    public static ShopDetailVo getShopDetailVo(TShop tShop,DeviceStatisticDto dto){
        ShopDetailVo vo = new ShopDetailVo();
        if(tShop != null){
            vo.setShopName(tShop.getShopName());
            vo.setAddress(tShop.getAddress());
            vo.setIsDefaultAddress(tShop.getIsDefaultAddress());
            vo.setProvince(tShop.getProvince());
            vo.setCity(tShop.getCity());
            vo.setCounty(tShop.getCounty());
            vo.setShopId(tShop.getShopId());
            vo.setMerchantId(tShop.getMerchantId());
            vo.setCreatedAt(tShop.getCreatedAt());
            vo.setCreatedBy(tShop.getCreatedBy());
            vo.setUpdatedAt(tShop.getUpdatedAt());
            vo.setUpdatedBy(tShop.getUpdatedBy());
        }
        if(dto != null){
            vo.setAllNum(dto.getAllNum());
            vo.setOnlineNum(dto.getOnlineNum());
            vo.setOfflineNum(dto.getOfflineNum());
        }else{
            vo.setAllNum(0);
            vo.setOnlineNum(0);
            vo.setOfflineNum(0);
        }
        return vo;
    }
}
